package com.boot.unity.api.modules.train.controller;

import com.boot.unity.api.modules.train.dto.AchievementDTO;
import com.boot.unity.api.modules.train.result.Result;
import com.boot.unity.api.modules.train.service.AchievementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "无纸化-考试成绩")
@RestController
@RequestMapping("/api/achievements")
@AllArgsConstructor
public class AchievementController {
    private final AchievementService achievementService;

    @PostMapping
    @ApiOperation(value = "保存")
    public Result save(@RequestBody AchievementDTO achievementDTO) {
        return achievementService.save(achievementDTO);
    }

//    @GetMapping("/{id}")
//    @ApiOperation(value = "根据id获取")
//    public Achievement get(@PathVariable Long id) {
//        return achievementDao.getById(id);
//    }
//
//    @PutMapping
//    @ApiOperation(value = "修改")
//    public Achievement update(@RequestBody Achievement achievement) {
//        achievementDao.update(achievement);
//
//        return achievement;
//    }
//
//    @GetMapping
//    @ApiOperation(value = "列表")
//    public PageTableResponse list(PageTableRequest tableRequest) {
//        return new PageTableHandler(
//            request -> achievementDao.count(request.getParams()),
//            request -> achievementDao.list(request.getParams(), request.getOffset(), request.getLimit())
//        ).handle(tableRequest);
//    }
//
//    @DeleteMapping("/{id}")
//    @ApiOperation(value = "删除")
//    public void delete(@PathVariable Long id) {
//        achievementDao.delete(id);
//    }
}
